package com.castday2.castday2.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.castday2.castday2.bean.User;
import com.castday2.castday2.bean.vo.Result;
import com.castday2.castday2.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author : 徐闯 mpcast
 * @Date : 2021-05-26 16:05:48
 * @Description : 验证统一返回格式
 **/
@RestController
@ResponseBody
@RequestMapping("/user")
public class ShowInfoController {
    @Autowired
    private UserService userService;
    @RequestMapping("/queryUser")
    public Result queryOne(){
        User user = userService.getOne(
                new QueryWrapper<User>()
                .eq("id",1)
        );
        return Result.ok(user);
    }
    @RequestMapping("/queryUsers")
    public Result queryUsers(){
        return Result.ok(
                userService.list()
        );
    }

}
